package cn.ysnk.clz.controller.adminBase;

import com.jfinal.core.Controller;

import cn.ysnk.clz.config.annotation.ControllerAnnotation;
import cn.ysnk.clz.interceptor.security.role.RoleEnum;

@ControllerAnnotation(url="/admin",roleType={RoleEnum.ROLE_ADMIN,RoleEnum.ROLE_MANAGER,RoleEnum.ROLE_USER})
public class AdminController extends Controller {
	public void index() {
		render("/admin/admin.jsp");
	}
	
	public void login(){
		boolean error = getParaToBoolean("error",false);
		if(error)
			setAttr("message", "用户名密码不对！");
		render("/admin/login.jsp");
	}
	
	public void adminLogin(){
		String username = getPara("username");
		String password = getPara("password");
		if("admin".equals(username.trim())&&"admin8848".equals(password.trim())){
			setSessionAttr("user", "admin");
			redirect("/admin");
		}else{
			setAttr("message", "用户名密码不对！");
			render("/admin/login.jsp");
		}
	}
	
	public void chooceIcon(){
		render("/admin/modal/chooceIcon.jsp");
	}
}
